package com.silverbox.waimai.service.goodscart.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.silverbox.waimai.entity.GoodsCart;
import com.silverbox.waimai.entity.GoodsCartDetail;
import com.silverbox.waimai.mapper.GoodsCartDetailMapper;
import com.silverbox.waimai.service.goodscart.GoodsCartDetailService;

@Service
public class GoodsCartDetailServiceImpl implements GoodsCartDetailService {
	@Autowired
	private GoodsCartDetailMapper goodsCartDetailMapper;

	@Override
	public void addGoodsCartDetail(List<GoodsCartDetail> goodsCartDetails, Integer goodsCartId) {
		goodsCartDetailMapper.insertByBatch(goodsCartDetails, goodsCartId);
	}

	@Override
	public void updateGoodsCartDetail(GoodsCartDetail goodsCartDetail) {
		goodsCartDetailMapper.updateByPrimaryKey(goodsCartDetail);
	}

	@Override
	public void deleteGcDetailByGcId(Integer goodCartId) {
		goodsCartDetailMapper.deleteGcDetailByGcId(goodCartId);
	}

	@Override
	public void removeGoodsCartDetail(GoodsCart goodsCart) {
		goodsCartDetailMapper.removeGoodsCartDetail(goodsCart);
	}

    @Override
    public List<GoodsCartDetail> getGoodsCartDetailByCartId(Integer goodsCartId) {
        return goodsCartDetailMapper.getGoodsCartDetailByCartId(goodsCartId);
    }
}
